import axios from 'axios'

axios.defaults.withCredentials = true;
axios.defaults.timeout = 60000;

// 在开发环境中的测试 development
if(process.env.NODE_ENV === 'development') {
    axios.defaults.baseURL = 'http://192.168.31.164:7878/'
}
// 在生产环境中的测试 production
if(process.env.NODE_ENV === 'production') {
    axios.defaults.baseURL = ''
}

export function _get(config) {
    const instance = axios.create({
        method: "GET"
    })
    return instance(config);
}

export function _post(config) {
    const instance = axios.create({
        method: "POST"
    })
    return instance(config);
}

export function _put(config) {
    const instance = axios.create({
        method: "PUT"
    })
    return instance(config);
}

export function _delete(config) {
    const instance = axios.create({
        method: "DELETE"
    })
    return instance(config);
}